-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `galeri_foto`
--

-- --------------------------------------------------------

--
-- Table structure for table `album`
--

CREATE TABLE `album` (
  `AlbumID` int(11) NOT NULL,
  `NamaAlbum` varchar(255) NOT NULL,
  `Deskripsi` text NOT NULL,
  `TanggalDibuat` date NOT NULL,
  `UserID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `album`
--

INSERT INTO `album` (`AlbumID`, `NamaAlbum`, `Deskripsi`, `TanggalDibuat`, `UserID`) VALUES
(4, 'pplg', 'poto poto kenangan buruk', '2026-01-23', 1),
(7, 'genshin impact', 'seputar gi', '2026-01-28', 1),
(8, 'jocep', 'my cowo', '2026-01-28', 1),
(9, 'krep', 'foto maul', '2026-02-05', 4),
(11, 'my cowo', 'rahmat fushiguro', '2026-02-12', 2),
(12, 'my?', 'iy', '2026-05-06', 7),
(14, 'class room of the elite', 'para murid pintar', '2026-05-07', 1);

-- --------------------------------------------------------

--
-- Table structure for table `foto`
--

CREATE TABLE `foto` (
  `FotoID` int(11) NOT NULL,
  `JudulFoto` varchar(255) NOT NULL,
  `DeskripsiFoto` text NOT NULL,
  `TanggalUnggah` date NOT NULL,
  `LokasiFile` varchar(255) NOT NULL,
  `AlbumID` int(11) NOT NULL,
  `UserID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `foto`
--

INSERT INTO `foto` (`FotoID`, `JudulFoto`, `DeskripsiFoto`, `TanggalUnggah`, `LokasiFile`, `AlbumID`, `UserID`) VALUES
(4, 'furina', 'my kisah', '2026-02-14', '935787620-furina.webp', 7, 1),
(7, 'komputer', 'gambar komputer', '2026-02-10', '1099394814-komputer.jpg', 4, 1),
(9, 'megumi', 'rahmat fushiguro', '2026-02-14', '1484580033-rahmat.jpg', 11, 2),
(10, 'jojo', 'jojo', '2026-02-14', '1255436663-jojo.jpg', 11, 2),
(11, 'ujicoba', 'bla bla bla', '2026-05-05', '293085293-8fb1cafcdf53e896c9fdc4580dc7c9ff.jpg', 8, 1),
(12, 'woni', 'inilah', '2026-05-06', '182891337-woni.jpg', 12, 7),
(13, 'wonii', 'iya ini', '2026-05-06', '1887550371-wonii.jpg', 12, 7),
(14, 'ujicoba', 'hahaha', '2026-05-07', '849696774-jungwon walpaper.jpg', 8, 1),
(15, 'sakayanagi', 'my favorite villain', '2026-05-07', '505527307-sakayanagi.jpeg', 14, 1),
(16, 'suzune horikita', 'my favorite student', '2026-05-07', '1215361689-suzune.jpeg', 14, 1);

-- --------------------------------------------------------

--
-- Table structure for table `komentarfoto`
--

CREATE TABLE `komentarfoto` (
  `KomentarID` int(11) NOT NULL,
  `FotoID` int(11) NOT NULL,
  `UserID` int(11) NOT NULL,
  `IsiKomentar` text NOT NULL,
  `TanggalKomentar` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `komentarfoto`
--

INSERT INTO `komentarfoto` (`KomentarID`, `FotoID`, `UserID`, `IsiKomentar`, `TanggalKomentar`) VALUES
(5, 7, 2, 'gg bang', '2026-02-12 00:00:00'),
(11, 9, 2, 'CAKEP BANH', '2026-02-12 00:00:00'),
(12, 9, 1, 'stress', '2026-02-12 00:00:00'),
(15, 7, 1, 'harganya berapa bang', '2026-02-14 00:00:00'),
(16, 4, 5, 'my bini jir', '2026-02-15 00:00:00'),
(17, 4, 6, 'bit karbit', '2026-02-15 00:00:00'),
(20, 11, 1, 'mantap', '2026-05-04 00:00:00'),
(28, 4, 7, 'karbida', '2026-05-06 00:25:58'),
(29, 13, 7, 'my bini gua itu', '2026-05-06 00:28:48'),
(30, 9, 7, 'NAJISS', '2026-05-06 00:29:28'),
(34, 13, 1, 'mimpi', '2026-05-06 20:14:05'),
(35, 11, 1, 'lucunya', '2026-05-06 20:14:54'),
(36, 4, 1, 'my bini gua itu', '2026-05-06 20:31:10'),
(38, 7, 1, 'p', '2026-05-06 20:46:51'),
(39, 15, 1, 'p', '2026-05-06 21:43:03'),
(40, 12, 1, 'nah akhinya finaly', '2026-05-06 22:11:57'),
(42, 7, 1, 'apa', '2026-05-11 18:29:27'),
(43, 13, 1, 'gg bang', '2026-05-11 18:36:37'),
(44, 13, 1, 'wah', '2026-05-11 18:37:49'),
(49, 12, 1, 'woy', '2026-05-11 18:57:35'),
(50, 12, 1, 'apa woy', '2026-05-11 18:57:44'),
(52, 14, 1, 'anjai', '2026-05-11 20:10:25'),
(57, 4, 1, 'my bini', '2026-05-12 20:02:13'),
(63, 4, 1, 'mantap', '2026-05-12 21:15:37'),
(64, 16, 1, 'my bini', '2026-05-12 21:29:35'),
(70, 4, 1, 'oke berhasil', '2026-05-13 00:00:32');

-- --------------------------------------------------------

--
-- Table structure for table `likefoto`
--

CREATE TABLE `likefoto` (
  `LikeID` int(11) NOT NULL,
  `FotoID` int(11) NOT NULL,
  `UserID` int(11) NOT NULL,
  `TanggalLike` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `likefoto`
--

INSERT INTO `likefoto` (`LikeID`, `FotoID`, `UserID`, `TanggalLike`) VALUES
(83, 4, 3, '2026-02-05'),
(86, 4, 4, '2026-02-05'),
(91, 7, 1, '2026-02-12'),
(94, 9, 2, '2026-02-12'),
(95, 9, 1, '2026-02-14'),
(97, 4, 2, '2026-02-14'),
(98, 7, 2, '2026-02-14'),
(100, 10, 1, '2026-02-15'),
(101, 4, 5, '2026-02-15'),
(102, 4, 6, '2026-02-15'),
(105, 4, 7, '2026-05-06'),
(106, 12, 7, '2026-05-06'),
(107, 13, 7, '2026-05-06'),
(112, 11, 1, '2026-05-07'),
(114, 13, 1, '2026-05-07'),
(116, 15, 1, '2026-05-07'),
(118, 14, 1, '2026-05-07'),
(119, 12, 1, '2026-05-07'),
(122, 16, 1, '2026-05-12'),
(123, 4, 1, '2026-05-13');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `album`
--
ALTER TABLE `album`
  ADD PRIMARY KEY (`AlbumID`),
  ADD KEY `UserID` (`UserID`);

--
-- Indexes for table `foto`
--
ALTER TABLE `foto`
  ADD PRIMARY KEY (`FotoID`),
  ADD KEY `AlbumID` (`AlbumID`),
  ADD KEY `UserID` (`UserID`);

--
-- Indexes for table `komentarfoto`
--
ALTER TABLE `komentarfoto`
  ADD PRIMARY KEY (`KomentarID`),
  ADD KEY `FotoID` (`FotoID`),
  ADD KEY `UserID` (`UserID`);

--
-- Indexes for table `likefoto`
--
ALTER TABLE `likefoto`
  ADD PRIMARY KEY (`LikeID`),
  ADD KEY `FotoID` (`FotoID`),
  ADD KEY `UserID` (`UserID`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `album`
--
ALTER TABLE `album`
  MODIFY `AlbumID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `foto`
--
ALTER TABLE `foto`
  MODIFY `FotoID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- AUTO_INCREMENT for table `komentarfoto`
--
ALTER TABLE `komentarfoto`
  MODIFY `KomentarID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=71;

--
-- AUTO_INCREMENT for table `likefoto`
--
ALTER TABLE `likefoto`
  MODIFY `LikeID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=124;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `album`
--
ALTER TABLE `album`
  ADD CONSTRAINT `album_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `user` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `foto`
--
ALTER TABLE `foto`
  ADD CONSTRAINT `foto_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `user` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `foto_ibfk_2` FOREIGN KEY (`AlbumID`) REFERENCES `album` (`AlbumID`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `komentarfoto`
--
ALTER TABLE `komentarfoto`
  ADD CONSTRAINT `komentarfoto_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `user` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `komentarfoto_ibfk_2` FOREIGN KEY (`FotoID`) REFERENCES `foto` (`FotoID`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints for table `likefoto`
--
ALTER TABLE `likefoto`
  ADD CONSTRAINT `likefoto_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `user` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `likefoto_ibfk_2` FOREIGN KEY (`FotoID`) REFERENCES `foto` (`FotoID`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

